﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Kingdee.WeksErp.Models.Users;

namespace Kingdee.WeksErp.Controllers
{
    public class BaseController : Controller
    {
        public UserInfo CurrentUserInfo => Session["User"] as UserInfo;

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            if (Session["User"] == null)
            {
                filterContext.HttpContext.Response.Redirect("/Account/login");

                filterContext.Result = new EmptyResult();
                return;
            }

            ViewBag.UserName = CurrentUserInfo.LoginID;
        }
    }
}